-
-
Notifications
You must be signed in to change notification settings - Fork 3
Checks selected variable is in choices available. #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ All contributors have signed the CLA |
Code Coverage Summary
Diff against main
Results for commit: c33e92d Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Tests Summary 1 files 24 suites 6s ⏱️ Results for commit c33e92d. ♻️ This comment has been updated with latest results. |
@llrs-roche would you be able to share a tmg example where it didnt fail with a warning and now it fails, and a print screen of the current and expected behavior? Thanks |
I have read the CLA Document and I hereby sign the CLA |
NB there is an I myself don't believe it's worth it to make this situation an error unless you go through the entire package and change similar places consistently but then I'm not an author here 😉 |
@m7pr @chlebowa I added a test case showing that this didn't fail previously at least with just teal.transform code:
The current expected behavior is to fail if you requests "OS" but only have "PARAMCD" as variable. |
Sorry for not being specific. What I was trying to say is the current design (I believe) is to not treat this situation as an error, which is why your added test didn't fail. This is a design choice that is reflected throughout the package. This change alters that design choice but only for this particular case. If you think this is warranted (with which I respectfully disagree), you should probably apply it in other places as well. I may have been wrong about the |
if (is.character(selected) && !inherits(choices, "delayed_variable_choices")) { | ||
if (!all(selected %in% choices$var_choices) || !all(selected %in% choices$var_label)) { | ||
stop("Selected, '", selected, "' is not in the available choices.") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to determine this at this point? If choices
are delayed, we can't guess if selected is a subset of the chocies.
@llrs-roche Let's close it and maybe address the issue here #255 |
I'll close but that might make increase the scope of #255. |
Pull Request
Fixes #253
This is a very minimal PR to help users use
choices_selected
andvalue_choices
together (see test added).The nested if is a matter of style to avoid having a line above 120 characters which would be flagged by the linter.